<%-- 
    Document   : add_fav_acc_form
    Created on : Sep 11, 2014, 3:40:23 PM
    Author     : hasnor
--%>

<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Akaun Favourite</title>
        <script type="text/javascript">
            
        
       function validate()
            {
                var noAccountFav=document.getElementById("noAkaunFav");
                var namaAccFav=document.getElementById("nama");
                
              
              
              
              if(!noAcc_validate(noAccountFav)){
                  return false;                  
              }else if(!name_validate(namaAccFav)){
                  return false;
              }else{
                  blockUI();
                  return true;
              }   
            }
            
         function noAcc_validate(noAccountFav)
            {
                if(noAccountFav.value.length>=1 && noAccountFav.value.length<=15)
                {
                    return true;
                }
                else
                {
                    alert("Sila isikan No Akaun TH");
                    noAccountFav.focus();
                    return false;
                }
            }
            
         function name_validate(namaAccFav)
            {
                if(namaAccFav.value.length>=1 && namaAccFav.value.length<=10)
                {
                    return true;
                }
                else
                {
                    alert("Sila isikan nama samaran (Nickname) untuk akaun 'Favourite'");
                    namaAccFav.focus();
                    return false;
                }
            }
            
       function validate1(f)
            {
                if(validate())
                {                        
                    f.action = "${pageContext.request.contextPath}/deposit?showAddFavDetail";
                    f.submit();
                }
            }  
            
         function resetAll()
         {
             document.getElementById("noAkaunFav").value="";
             document.getElementById("nama").value="";
         }
         
         function goBack()
            {
                window.history.back();
            }
            
        </script>
    </head>
    <body>
        
        <s:form beanclass="th.stripes.action.DepositActionBean" class="niceform">
           <s:hidden name="deposit.noAkaun" id="noAkaun"></s:hidden> 
            <s:errors/>
            <s:messages/>
            <div id="content">
                <div id="logo">
                    <span>
                        <img src="${pageContext.request.contextPath}/images/img/ribbon.png"/>               
                    </span>
                </div>
                <h3>                
                    Tambah <i>Favourite Account</i>
                </h3>
               
                
                <p>
                    <label><font color="red">*</font>No. Akaun TH :</label>
                    <s:text name="deposit.noAkaunFav" id="noAkaunFav" maxlength="15"/> 
                    
                </p>
     
                 <p>
                     <label><font color="red">*</font>Nama Samaran  </label><br/>
                     <label>(<i>Nickname</i>) Akaun :</label> 
                     <label></label><s:text name="deposit.nicknameAkaunFav" id="nama" maxlength="10"/>
                </p>
               
                <p>
                    <label></label>
                    <font size="2">Ruangan mandatori bertanda <font color="red">*</font> adalah wajib diisi.</font>
                </p>
                 <p align="center">      
                        
                         <%-- <s:submit name="showAddFavDetail" value="Simpan" class="button green button_blockUI" onclick="validate1(this.form)" /> --%>
                        <s:button name="back" value="Kembali" class="button green" onclick="goBack()"/>
                        <s:button name="showAddFavDetail" value="Seterusnya" class="button green" onclick="validate1(this.form)"/>
                        <s:button name="reset" value="Isi Semula" onclick="resetAll()" class="button green"/> 
                        
                </p>
               
            </div>
        </s:form>        
    </body>
</html>
